import { Button, Card, Descriptions } from 'antd';
import { useLocation, useNavigate } from 'react-router-dom'

export default function ShowHospital() {

    const detail: any = useLocation();
    const navigate = useNavigate()

    return (
        <Card>
            <Descriptions title="基本信息" bordered column={4}>
                <Descriptions.Item label="医院名称" span={2}>{detail.state.hosname}</Descriptions.Item>
                <Descriptions.Item label="医院logo" span={2}>
                    <img src={`data:image/jpeg;base64,${detail.state.logoData}`} alt="" />
                </Descriptions.Item>
                <Descriptions.Item label="医院编码" span={2}>{detail.state.hoscode}</Descriptions.Item>
                <Descriptions.Item label="医院地址" span={2}>{detail.state.param.fullAddress}</Descriptions.Item>
                <Descriptions.Item label="坐车路线" span={4}>
                    {detail.state.route}
                </Descriptions.Item>
                <Descriptions.Item label="医院简介" span={4}>
                    {detail.state.intro}
                </Descriptions.Item>
            </Descriptions>
            <Descriptions className='mt' title="预约规则信息" bordered column={4}>
                <Descriptions.Item label="预约周期" span={2}>{detail.state.bookingRule.cycle}</Descriptions.Item>
                <Descriptions.Item label="放号时间" span={2}>
                    {detail.state.bookingRule.releaseTime}
                </Descriptions.Item>
                <Descriptions.Item label="停挂时间" span={2}>{detail.state.bookingRule.stopTime}</Descriptions.Item>
                <Descriptions.Item label="退号时间" span={2}>{detail.state.bookingRule.quitTime}</Descriptions.Item>
                <Descriptions.Item label="预约规则" span={4}>
                    {detail.state.bookingRule.rule.map((item: any, index: any) => {
                        return (
                            <div key={index}>{index + 1}.{item}</div>
                        )
                    })}
                </Descriptions.Item>
            </Descriptions>
            <Button className='mt' onClick={() => navigate("/syt/hospital/hospitalList")}>返回</Button>
        </Card>
    )
}
